﻿using System;

namespace awaitasync
{
    class Program
    {
        static async Task Main(string[] args)
        {
            string fileName = @"d:\test\1.txt";
            //同步方法
            /*File.WriteAllText(fileName, "写入数据");
            string s = File.ReadAllText(fileName);*/
            //异步
            await File.AppendAllTextAsync(fileName, "写入数据1");
            string s = await File.ReadAllTextAsync(fileName);
            /*Task<string> t = File.ReadAllTextAsync(fileName);
            string s = await t;*/
            Console.WriteLine(s);
        }
    }
}